import re

reverse_output_list = []  # 定义全局变量的初始值


def string_reverse_output(pending_character, string_length):
    global reverse_output_list  # 定义全局变量
    if string_length == 0:
        return
    else:
        x = pending_character[string_length - 1]
        reverse_output_list.append(x)
        """递归"""
        string_reverse_output(pending_character, string_length - 1)


pending_character = input("请输入一行字符串：")
string_length = len(pending_character)
string_reverse_output(pending_character, string_length)
if string_length == 0:
    print("请输入正确格式的字符串!")
else:
    reverse_output = "".join(reverse_output_list)

s=reverse_output
str= re.sub('[^A-Za-z]','',s)
print(str)

